<#if isWithPackage?exists && isWithPackage==true>package ${packageName}.${moduleName}.service.impl;</#if>

<#if isAutoImport?exists && isAutoImport==true>
import  ${packageName}.${moduleName}.entity.${classInfo.className};
import  ${packageName}.${moduleName}.mapper.${classInfo.className}Mapper;
import  ${packageName}.${moduleName}.qo.${classInfo.className}Condition;
import  ${packageName}.qo.RequestCondition;
import  ${packageName}.qo.RequestPageCondition;
import  ${packageName}.${moduleName}.service.${classInfo.className}Service;
import  ${packageName}.utils.QueryConditionBuilder;
import lombok.extern.slf4j.Slf4j;
import org.beetl.sql.core.page.PageResult;
import org.beetl.sql.core.query.LambdaQuery;
import org.beetl.sql.core.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
</#if>
/**
 * @description ${classInfo.classComment}
 * @author ${authorName}
 * @date ${.now?string('yyyy-MM-dd')}
 */
@Service
@Slf4j
public class ${classInfo.className}ServiceImpl extends SuperServiceImpl<${classInfo.className},${classInfo.className}Condition> implements ${classInfo.className}Service{
    @Autowired
    private ${classInfo.className}Mapper ${classInfo.className?uncap_first}Mapper;

    @Override
    public List<${classInfo.className}> list(RequestCondition condition) {
    Query<${classInfo.className}> query = ${classInfo.className?uncap_first}Mapper.createQuery();
        new  QueryConditionBuilder().queryConditionBuilder(query,condition.getEntity());
        return query.select();
    }
    @Override
    public PageResult<${classInfo.className}> page(RequestPageCondition condition) {
        LambdaQuery<${classInfo.className}> query = ${classInfo.className?uncap_first}Mapper.createLambdaQuery();
        new  QueryConditionBuilder().queryConditionBuilder(query,condition.getEntity());
        return query.page(condition.getPageNumber(), condition.getPageSize());
    }

    @Override
    public  ${classInfo.className} get(Long id) {
        ${classInfo.className}  ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.single(id);
        return ${classInfo.className?uncap_first};
    }

    @Override
    public boolean delete(Long id) {
        int ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.deleteById(id);
        return ${classInfo.className?uncap_first} >0;
    }


    @Override
    public boolean update(final  ${classInfo.className}  new${classInfo.className}) {
        ${classInfo.className}   ${classInfo.className?uncap_first} = ${classInfo.className?uncap_first}Mapper.unique( new${classInfo.className}.getId());
        if ( ${classInfo.className?uncap_first} != null) {
            int flag = ${classInfo.className?uncap_first}Mapper.updateTemplateById( new${classInfo.className});
            return flag > 0;
        }
        return false;
    }


    @Override
    public Integer save(final  ${classInfo.className}  ${classInfo.className?uncap_first}) {
        int insertFlag = ${classInfo.className?uncap_first}Mapper.insertTemplate(${classInfo.className?uncap_first});
        return insertFlag;
    }

    @Override
    public int[] batchSave(final  List<${classInfo.className}>  ${classInfo.className?uncap_first}List) {
        int[] insertFlag = ${classInfo.className?uncap_first}Mapper.insertBatch(${classInfo.className?uncap_first}List);
        return insertFlag;
    }
}
